import random, pyautogui, asyncio
from db import RolesDB

from core.base_controller import BaseController
from core.utils import focus_wow
from controllers.login_role_controller import LoginRoleController
from controllers.common_actions import CommonActions
from controllers.auto_salvage_card.auto_salvage_card_actions import AutoSalvageCardActions

class AutoSalvageCardController(BaseController):
  async def extra_actions(self, log_prefix):
    common_actions = CommonActions(log_prefix=log_prefix, ws_client=self.ws_client)
    auto_salvage_card_actions = AutoSalvageCardActions(log_prefix=log_prefix, ws_client=self.ws_client)
    await self.log("extra_actions start", log_prefix=log_prefix)

    ## 收邮件
    await common_actions.get_emails()
    await asyncio.sleep(random.randint(4, 5))
    
    ## 拆分
    await auto_salvage_card_actions.start_salvage()
        
    await self.log("extra_actions end", log_prefix=log_prefix)